package com.agileboot.medicine.controller.system;


import com.agileboot.common.core.dto.ResponseDTO;
import com.agileboot.common.core.page.PageDTO;
import com.agileboot.domain.store.StoreQuery;
import com.agileboot.domain.store.db.StoreInfo;
import com.agileboot.domain.store.db.StoreInfoService;
import com.agileboot.domain.store.form.StoreMedicineForm;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 收藏信息表
 * (StoreInfo)表控制层
 *
 * @author lx
 * @since 2024-02-22 19:22:40
 */
@RestController
@RequestMapping("/storeInfo")
public class StoreInfoController {
    /**
     * 服务对象
     */
    @Resource
    private StoreInfoService storeInfoService;

    /**
     * 收藏或者取消收藏
     * @param storeMedicineForm
     * @return
     */
    @PostMapping("/save")
    @ApiOperation(value = "添加收藏", notes = "添加收藏")
    public ResponseDTO saveStoreMedicine(@RequestBody StoreMedicineForm storeMedicineForm) {
        return storeInfoService.saveStoreMedicine(storeMedicineForm);
    }

    /**
     * 查询用户是否收藏
     * @param storeMedicineForm
     * @return
     */
    @PostMapping("/isStore")
    @ApiOperation(value = "查询用户是否收藏", notes = "查询用户是否收藏")
    public ResponseDTO isStore(@RequestBody StoreMedicineForm storeMedicineForm) {
        return storeInfoService.isStore(storeMedicineForm);
    }


    /**
     * 用户收藏分页列表
     * @param storeQuery
     * @return
     */
    @PostMapping("/page")
    @ApiOperation(value = "用户收藏分页列表", notes = "用户收藏分页列表")
    public ResponseDTO<PageDTO<StoreInfo>> storePage(@RequestBody StoreQuery storeQuery) {
        return storeInfoService.storePage(storeQuery);
    }

}

